package com.example.shoppingmallspringboot.controller;

import com.example.shoppingmallspringboot.entity.Swiper;
import com.example.shoppingmallspringboot.service.SwiperService;
import com.example.shoppingmallspringboot.util.FwResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.GetMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

//@Controller
//@ResponseBody
@RestController //该注解等价于//@Controller+@ResponseBody
@Tag(name = "SwiperController",description = "轮播图控制器")
public class SwiperController {
    @Autowired
    SwiperService swiperService;
    @GetMapping("/swiper/list")
    @Operation(summary = "获取轮播图",description = "无参")
    public FwResult<List<Swiper>>  getAllCarousel(){
        List<Swiper> swiper = swiperService.getAllCarousel();
        FwResult<List<Swiper>> result=FwResult.ok(swiper);
        return result;
    }
}
